#ifndef UTILS_H
#define UTILS_H

#include <QtGlobal>
#include "point.h"
#include "block.h"

class Utils
{
public:
    static const double Radius;
    static qreal shortestDistance(const Point & p, const Point & s1, const Point & s2, const Point & s3);
    static qreal shortestDistance(const Point & p1, const Point & p2);
    static qreal angleDistance(const Point & p1, const Point & p2);
    static bool intersects(const Segment & segment, const Point2d & center, double angleRadius);
    static bool intersects(const Point & p1, const Point & p2, const Point & center, double radius);
    static inline double scalarProduct(int x1, int y1, int z1, int x2, int y2, int z2);
    static double toRadians(double degrees);
    static double toDegrees(double radians);

    template <typename T>
    static qint8 sign(T value)
    {
        return (value > 0.0)? 1: (value < 0.0)? -1: 0;
    }
};

#endif // UTILS_H
